package com.fingard.dsp.bank.reqrespobj.foreigncurrsingle;

import com.fingard.dsp.bank.reqrespobj.ReqRespHeader;
import com.fingard.dsp.bank.reqrespobj.RequestBase;
import com.fingard.dsp.bank.reqrespobj.foreigncurrsingle.detail.ReqForeignCurrPayRecDetail;
import com.fingard.xml.XmlTextReader;

//跨境外币请求类初始化ReqCrossBorderPayRecDetail数据信息
public class ReqForeignCurrSingle extends RequestBase{

	public ReqForeignCurrPayRecDetail singleDetail = null;

	private XmlTextReader xmlReader;
	public ReqForeignCurrSingle(XmlTextReader p_xmlReader, ReqRespHeader p_header) throws Exception{
		reqHeader = p_header;
		xmlReader = p_xmlReader;
		
		if(xmlReader.read(PATH_Detail)){//"/ATSYH/TransReq/TransParam/DetailRecord"
			singleDetail = new ReqForeignCurrPayRecDetail(xmlReader.readedXElement, reqHeader.transType,reqHeader.bankCode);
		}
		else{
			throw new Exception("不存在节点："+PATH_Detail);
		}
	}

    public boolean readRecord() throws Exception{
        singleDetail = null;
        if(xmlReader.read(PATH_Detail)){
            singleDetail = new ReqForeignCurrPayRecDetail(xmlReader.readedXElement, reqHeader.transType,reqHeader.bankCode);
            return true;
        }
        else{
            return false;
        }
    }
}
